package com.yanmaohu.yulia.bean;

/**
 * @author Bright Lee
 */
public final class ValueExpressionPrimaryIntervalQualifier implements IntervalPrimary {

    private int beginIndex;
    private int endIndex;
    private ValueExpressionPrimary valueExpressionPrimary;
    private IntervalQualifier intervalQualifier;

    public ValueExpressionPrimaryIntervalQualifier(ValueExpressionPrimary valueExpressionPrimary,
                                                   IntervalQualifier intervalQualifier) {
        this.beginIndex = valueExpressionPrimary.getBeginIndex();
        this.endIndex = intervalQualifier != null ? intervalQualifier.getEndIndex() : valueExpressionPrimary.getEndIndex();
        this.valueExpressionPrimary = valueExpressionPrimary;
        this.intervalQualifier = intervalQualifier;
    }

    @Override
    public int getBeginIndex() {
        return beginIndex;
    }

    @Override
    public int getEndIndex() {
        return endIndex;
    }

    public ValueExpressionPrimary getValueExpressionPrimary() {
        return valueExpressionPrimary;
    }

    public IntervalQualifier getIntervalQualifier() {
        return intervalQualifier;
    }

}
